package com.hkts.naturalgas.tcp;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @ClassNameTcpServerRun
 * @Description
 * @Author yck
 * @Date2021-12-03 10:03
 * @Version V1.0
 **/
@Component
@Order(1)
@Slf4j
public class TcpServerRun implements ApplicationRunner {

    private int port=9900;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        try {
            new TcpServer(port).start();
        }catch(Exception e) {
            log.error("TcpServerError:"+e.getMessage());
            e.printStackTrace();
        }
    }
}
